import { http } from './index'

type typeServerTime = {
  dateTime:string
}

function formatToken (token: string) {
  return "Bearer " + token;
};
export function getServerTime(){
  return http.request<typeServerTime>('get','/uwc/time')
}


export function getOrderStats(cityId:number){
  return http.request<any>('get','/uwc/orderStats?cityId='+cityId)
}

export function getDrugTakingStatus(cityId:number){
  return http.request<any>('get','/uwc/drugTakingDynamics?cityId='+cityId)
}

export function getUserStats(cityId:number){
  return http.request<any>('get','/uwc/userStats?cityId='+cityId)
}

export function getAppointments(cityId:number){
  return http.request<any>('get','/uwc/appointments?cityId='+cityId)
}

export function getMapOrders(cityId:number){
  return http.request<any>('get','/uwc/mapOrders?cityId='+cityId)
}

// 获取用户详情
export function getUserInfo(token:string){
  return http.request<any>('get','https://saas-api.wanhuhealth.com/users/currentUserInfo',{},{ headers:{'Authorization':formatToken(token),"content-type": "application/x-www-form-urlencoded"}})
}

// 登录入口
export function loginApi(loginData:object){
  return http.request<any>('post','https://saas-api.wanhuhealth.com/users/login',{},
  { 
    headers:{"content-type": "application/x-www-form-urlencoded"},
    data:loginData

  })
}
